package com.christianposta.learnddd.domain.shared;

public interface Entity<T> {

	/**
	 * Determine whether this entity is the same as the entity passed in. The
	 * comparison should implement logic that is vital to the domain's understanding
	 * and interpretation of "identity."
	 * 
	 * Entities are objects in a domain model that have an identity.
	 * Identity is a meaning within the domain that indicates a model
	 * has a life cycle and unique characteristics that set it apart from
	 * any other object, regardless of attributes. In other words, two objects
	 * with the same attributes do not necessarily have the same identity.
	 * 
	 * In practice an identity is defined by a set of constrained attributes
	 * or keys that are either set by the user or are automatically generated.
	 * However, it's not the fact that an object has a key that gives it identity,
	 * it's the true meaning of an object within a given domain context that
	 * gives it an identity. For example, a Person object may have identity in
	 * the following context: driver's license system that records a person's 
	 * driving history. In this context, a person has an identity because it's 
	 * vital to the immediate domain, and can live outside the walls of a licensing
	 * system. The same person may have a criminal record too, and when they record
	 * a bad driving history, their criminal record may be pulled and used in court
	 * to show a pattern of recklessness. If the person didn't have a distinct identity,
	 * the wrong criminal record could be pulled. An example where a person may not
	 * have or need an identity would be a system that does a census count of the 
	 * number of people in the world. Each individual person and their identity are 
	 * not necessary for the count, just the fact that a person exists. This is a 
	 * good example of a value object. Value objects do not have an identity that 
	 * lives indefinitely.
	 *  
	 *  
	 * @param other
	 * @return
	 */
	boolean sameIdentityAs(T other);
}
